<?php
namespace common\steamauth;
use think\Config;

class SteamConfig{
	public static function getConfig(){
		$steamauth = Config::get('steam_config');
		if(empty($steamauth['apikey'])){
			throw new \Exception("steam_config not find apikey");
		}
		if (empty($steamauth['domainname'])) {
			$steamauth['domainname'] = $_SERVER['SERVER_NAME'];
		}
		if (empty($steamauth['logoutpage'])) {
			$steamauth['logoutpage'] = $_SERVER['PHP_SELF'];
		}
		if (empty($steamauth['domainname'])) {
			$steamauth['loginpage'] = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
		}else{
			$steamauth['loginpage'] = $steamauth['domainname'].$_SERVER['REQUEST_URI'];
		}
		return $steamauth;
	}
}

